﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEditor;
using UnityEngine;
//动态数组：对象的有序集合
//动态数组会自动重新调整它的大小
//可以使用索引在指定位置添加和移除项目，它也允许在列表中进行动态内存分配
/// <summary>
/// 动态数组
/// </summary>
public class ArrayList1 : MonoBehaviour
{
   
    ArrayList arrayList1 = new ArrayList();
    [SerializeField]
    private int[] arrayList;
    // Start is called before the first frame update
    void Start()
    {
      
        arrayList1.Add(1);
        arrayList1.Add(10);
        arrayList1.Add(20);


        Debug.Log(arrayList1[0]); Debug.Log(arrayList1[1]);

        foreach (var item in arrayList1)
        {
            Debug.Log(item);
        }
        //arrayList1.Clear();

        if (arrayList1.Contains(20))
        {

        }


        arrayList1.IndexOf(12);//打印出下标

        arrayList1.Insert(3, 66);//插入

        arrayList1.Reverse();//逆转

        arrayList1.Sort();//顺序排列

    }
   // [MenuItem("GameTool/Test")]
    private static void Test()
    {
        Debug.Log("test");
    }
  
    public void Test1()
    {
        Debug.Log("test1");
    }
    // Update is called once per frame
    void Update()
    {
        Debug.Log("test1");
    }
}

public class Plays
{

}
